import { ApiCall, WsConnection } from "tsrpc";
import { roomServer } from "../..";
import { ReqExitRoom, ResExitRoom } from "../../shared/protocols/room/PtlExitRoom";
import { ServiceType } from "../../shared/protocols/serviceProto";

export async function ApiExitRoom(call: ApiCall<ReqExitRoom, ResExitRoom>) {
    const conn = call.conn as WsConnection<ServiceType>;
    let ret = roomServer.remove(conn, call.req.roomId);
    call.succ({
        ...ret
    });
}